<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- sleep函数作用是让线程休眠，等到指定时间在重新唤起。 -->
    <script>
        function sleep(ms) {
            return new Promise((resolve, reject) => {
                setTimeout(resolve, ms);
            })
        }
        sleep(2000).then(() => {
            console.log('chuchuchu');

        })
    </script>>

</html>